import axios from '@/libs/axios1.js'
let headers = {'content-type': 'application/json;charset=UTF-8'}

// 查询问卷下用户 分页
export const queryQuestionnaireDetail = params =>{
    return axios({
        url: '/questionnaire/submitRecord',
        method: 'get',
        headers,
        params
    })
}

// 查询问卷列表
export const getQuestionnaireSurveyList = params =>{
    return axios({
        url: '/questionnaire/questionnaire',
        method: 'get',
        headers,
        params
    })
}

// 创建问卷调查
export const createQuestionnaireSurvey = data =>{
    return axios({
        url: '/questionnaire/questionnaire',
        method: 'post',
        headers,
        data
    })
}

// 修改问卷调查
export const updateQuestionnaireSurvey = data =>{
    return axios({
        url: '/questionnaire/questionnaire',
        method: 'put',
        headers,
        data
    })
}

// 删除问卷调查
export const deleteQuestionnaireSurvey = id =>{
    return axios({
        url: `/questionnaire/questionnaire/${id}`,
        method: 'delete',
        headers
    })
}

// 创建问卷题目
export const createSurveyContent = data =>{
    return axios({
        url: '/questionnaire/content',
        method: 'post',
        headers,
        data
    })
}

// 修改问卷题目
export const updateSurveyContent = data =>{
    return axios({
        url: '/questionnaire/content',
        method: 'put',
        headers,
        data
    })
}

// 删除问卷题目
export const deleteSurveyContent = id =>{
    return axios({
        url: `/questionnaire/content/${id}`,
        method: 'delete',
        headers
    })
}

// 查询问卷题目
export const getSurveyContentList = params =>{
    return axios({
        url: '/questionnaire/content',
        method: 'get',
        headers,
        params
    })
}
// 查询问卷下用户 分页
export const queryUser = params =>{
    return axios({
        url: '/questionnaire/user',
        method: 'get',
        headers,
        params
    })
}
// 增加用户
export const addUser = params =>{
    return axios({
        url: '/questionnaire/user',
        method: 'post',
        headers,
        data:params
    })
}
// 删除用户
export const delUser = id =>{
    return axios({
        url: `/questionnaire/user/${id}`,
        method: 'delete',
        headers,
    })
}
// 查询已添加用户
export const getUser = params =>{
    return axios({
        url: `/questionnaire/user/list`,
        method: 'get',
        params:params
    })
}

export const getQuestionnaireStatistics = id => {
    return axios({
        url: `/questionnaire/questionnaire/statistics/${id}`,
        method: 'get'
    })
}

// 删除问卷题目的选项
export const deleteContentOption = id =>{
    return axios({
        url: `/questionnaire/content/option/${id}`,
        method: 'delete',
        headers
    })
}